package sealte.database.monitor.config;

import java.util.List;

import org.jdom2.Element;

import sealte.util.xml.XMLReader;

public class ConfigReader {
	
	private String configPath = null;
	
	public ConfigReader(String fileName){
		this.configPath = ConfigReader.class.getResource("").getPath()+fileName+".xml";
	}
	
	public String[][] getObjects() throws Exception {
		List<Element> all = XMLReader.getElements(this.configPath, null);
		String[][] ons = new String[all.size()][2];
		for(int i=0;i<all.size();i++){
			Element ele = (Element)all.get(i);
			ons[i][0] = ele.getName();
			ons[i][1] = ele.getValue();
		}
		return ons;
	}
	
	public int getObjectNum() throws Exception {
		return this.getObjects().length;
	}
}
